package com.zide.file.config.properties;

import cn.hutool.core.util.StrUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
import java.util.List;

/**
 * @author 石添添
 * @date 2024-09-12 15:05
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "file.local")
public class LocalProperties {

    @Schema(description = "文件存储根路径")
    private String baseDir;

    @Schema(description = "nginx代理路径")
    private String ngProxy;

    @Schema(description = "允许上传的文件类型")
    private List<String> allowTypes;

    public void setAllowTypes(String allowTypes) {
        if (!StrUtil.isEmpty(allowTypes)) {
            this.allowTypes = Arrays.asList(allowTypes.split(","));
        }
    }
}
